#define D2D_INPUT_COUNT 1
#define D2D_INPUT0_SIMPLE
#define D2D_REQUIRES_SCENE_POSITION
#include "d2d1effecthelpers.hlsli"

//角度
float angle;

float2 position;
float radius;


D2D_PS_ENTRY(main) {


	//当前位置
	float2 cPoint = D2DGetScenePosition().xy;

	//当前点到中的的距离
	float dist = distance(position, cPoint);
	if (dist <= radius) {
		float a;
		//需要旋转的角度
		a = angle * (1-dist / radius);
		float rx = cPoint.x - position.x;
		float ry = cPoint.y - position.y;
		float tx = position.x + rx * cos(a) + ry * sin(a);
		float ty = position.y + ry * cos(a) - rx * sin(a);
		float4 color = D2DSampleInputAtPosition(0, float2(tx, ty));
		return color;
	}
	return D2DGetInput(0);
}


